package com.example.demos.controller;

import com.example.demos.mapper.UserMapper;
import com.example.demos.model.UserModel;
import com.example.demos.service.UserService;
import com.fasterxml.jackson.databind.util.JSONPObject;
import com.sun.org.apache.bcel.internal.generic.NEW;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class UserController {
    @Autowired
    public UserMapper userMapper;
    @Autowired
    public UserService userService;

//    获取用户数据
    @RequestMapping("/getinfo")
    public List<UserModel> getinfo(){
        List<UserModel> user=userMapper.getinfo();
        return user;
    }
    @RequestMapping(value = "/regist",method = RequestMethod.POST)
    public int regist(@RequestBody UserModel parms){
        int res=userService.regist(parms);
        return res;
    }
}